
// --= Called when changing/loading the search type. Displays additional options based on selected type =--
function set_search_type(type)
{

	var obj = document.getElementById('type_'+type.value);

	if(obj)
	{

		// --= disable all  st_options =--
		var st_options = document.getElementById('st_options').getElementsByTagName('DIV');
		for(var i = 0; i < st_options.length; i++)
		{

			st_options[i].style.display = 'none';

			if(st_options[i].id == 'type_'+ type.value)
			{

				st_options[i].style.display = 'block';
				document.location.hash = type.value;

			}

		}

	}

}

// --= Because the 'search_type' field uses smarty's html_options to genereate the html, we use the following to set the onclick commands for each radio button =--
function load_search_type_events()
{

	var obj = document.getElementById('search_types').getElementsByTagName('INPUT');

	loaded = false;

	hash = document.location.hash.substr(1);

	for(var i = 0; i < obj.length; i++)
	{

		if(hash != '' && loaded == false)
		{

			if(hash == obj[i].value)
			{

				obj[i].checked = true;

				set_search_type(obj[i]);
				loaded = true;

			}

		}
		else if(obj[i].checked && loaded == false)
		{

			loaded = true;
			set_search_type(obj[i]);

		}

		obj[i].onclick = function()
		{

			set_search_type(this);

		}

	}

}